package interfaz;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import mundo.floristeria1;


/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class VentanaPrincipal extends javax.swing.JFrame implements ActionListener{
	private floristeria1 miFloristeria;

	private JLabel EtiquietaPedido1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JButton jButton1ValorPedido;
	private JComboBox jComboBox7;
	private JComboBox jComboBox6;
	private JComboBox jComboBox5;
	private JComboBox jComboBox4;
	private JLabel EtiquetaCalificacion;
	private JComboBox jComboBox3;
	private JComboBox jComboBox2;
	private JComboBox jComboBox1;
	private JComboBox JcomoBox1;
	private JTextField jTextField3;
	private JTextField jTextField2;
	private JTextField jTextField1;
	private JTextField Pedido1;
	private JLabel EtiquetaCantidad;
	private JLabel jLabel1;

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaPrincipal inst = new VentanaPrincipal();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}

	public VentanaPrincipal() 
	{

		super();
		
		initGUI();
	}

	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				EtiquietaPedido1 = new JLabel();
				getContentPane().add(EtiquietaPedido1);
				EtiquietaPedido1.setText("Pedido1");
				EtiquietaPedido1.setBounds(32, 50, 48, 15);
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("Pedido2");
				jLabel1.setBounds(32, 78, 48, 15);
			}
			{
				jLabel2 = new JLabel();
				getContentPane().add(jLabel2);
				jLabel2.setText("Pedido3");
				jLabel2.setBounds(32, 105, 48, 15);
			}
			{
				jLabel3 = new JLabel();
				getContentPane().add(jLabel3);
				jLabel3.setText("Pedido4");
				jLabel3.setBounds(32, 139, 48, 15);
			}
			{
				EtiquetaCantidad = new JLabel();
				getContentPane().add(EtiquetaCantidad);
				EtiquetaCantidad.setText("Cantidad");
				EtiquetaCantidad.setBounds(99, 19, 68, 19);
			}
			{
				Pedido1 = new JTextField();
				getContentPane().add(Pedido1);
				Pedido1.setBounds(92, 47, 49, 22);
			}
			{
				jTextField1 = new JTextField();
				getContentPane().add(jTextField1);
				jTextField1.setBounds(92, 75, 49, 22);
				
			}
			{
				jTextField2 = new JTextField();
				getContentPane().add(jTextField2);
				jTextField2.setBounds(92, 102, 49, 22);
			}
			{
				jTextField3 = new JTextField();
				getContentPane().add(jTextField3);
				jTextField3.setBounds(92, 136, 49, 22);
			}
			{
				ComboBoxModel JcomoBox1Model = 
					new DefaultComboBoxModel(
							new String[] { "Rosa", "tulipanes","girasoles","Crisantemos" });
				JcomoBox1 = new JComboBox();
				getContentPane().add(JcomoBox1);
				JcomoBox1.setModel(JcomoBox1Model);
				JcomoBox1.setBounds(167, 42, 89, 23);
			}
			{
				ComboBoxModel jComboBox1Model = 
					new DefaultComboBoxModel(
							new String[] { "Rosa", "tulipanes","girasoles","Crisantemos" });
				jComboBox1 = new JComboBox();
				getContentPane().add(jComboBox1);
				jComboBox1.setModel(jComboBox1Model);
				jComboBox1.setBounds(167, 72, 89, 23);
			}
			{
				ComboBoxModel jComboBox2Model = 
					new DefaultComboBoxModel(
							new String[] { "Rosa", "tulipanes","girasoles","Crisantemos" });
				jComboBox2 = new JComboBox();
				getContentPane().add(jComboBox2);
				jComboBox2.setModel(jComboBox2Model);
				jComboBox2.setBounds(167, 101, 89, 23);
			}
			{
				ComboBoxModel jComboBox3Model = 
					new DefaultComboBoxModel(
							new String[] { "Rosa", "tulipanes","girasoles","Crisantemos" });
				jComboBox3 = new JComboBox();
				getContentPane().add(jComboBox3);
				jComboBox3.setModel(jComboBox3Model);
				jComboBox3.setBounds(167, 131, 89, 23);
			}
			{
				EtiquetaCalificacion = new JLabel();
				getContentPane().add(EtiquetaCalificacion);
				EtiquetaCalificacion.setText("Calificacion");
				EtiquetaCalificacion.setBounds(314, 23, 64, 15);
			}
			{
				ComboBoxModel jComboBox4Model = 
					new DefaultComboBoxModel(
							new String[] { "0", "1" });
				jComboBox4 = new JComboBox();
				getContentPane().add(jComboBox4);
				jComboBox4.setModel(jComboBox4Model);
				jComboBox4.setBounds(302, 53, 76, 23);
			}
			{
				ComboBoxModel jComboBox5Model = 
					new DefaultComboBoxModel(
							new String[] { "0", "1" });
				jComboBox5 = new JComboBox();
				getContentPane().add(jComboBox5);
				jComboBox5.setModel(jComboBox5Model);
				jComboBox5.setBounds(302, 53, 76, 23);
			}
			{
				ComboBoxModel jComboBox6Model = 
					new DefaultComboBoxModel(
							new String[] { "0", "1" });
				jComboBox6 = new JComboBox();
				getContentPane().add(jComboBox6);
				jComboBox6.setModel(jComboBox6Model);
				jComboBox6.setBounds(302, 53, 76, 23);
			}
			{
				ComboBoxModel jComboBox7Model = 
					new DefaultComboBoxModel(
							new String[] { "0", "1" });
				jComboBox7 = new JComboBox();
				getContentPane().add(jComboBox7);
				jComboBox7.setModel(jComboBox7Model);
				jComboBox7.setBounds(302, 53, 76, 23);
			}
			{
				jButton1ValorPedido = new JButton();
				getContentPane().add(jButton1ValorPedido);
				jButton1ValorPedido.setText("Valor Pedido");
				jButton1ValorPedido.setBounds(146, 209, 96, 22);
				jButton1ValorPedido.addActionListener(this);
			}
			pack();
			this.setSize(498, 418);
		} catch (Exception e) {
			//add your error handling code here
			e.printStackTrace();
		}
	}

	@Override
	public void actionPerformed(ActionEvent e) 
	{
		if(e.getSource()==jButton1ValorPedido)
		{
			int cantidad0=Integer.parseInt(Pedido1.getText());
			int cantidad1=Integer.parseInt(jTextField1.getText());
			int cantidad2=Integer.parseInt(jTextField2.getText());
			int cantidad3=Integer.parseInt(jTextField3.getText());
			int nombre1=JcomoBox1.getSelectedIndex();
			int nombre2=jComboBox1.getSelectedIndex();
			int nombre3=jComboBox2.getSelectedIndex();
			int nombre4=jComboBox3.getSelectedIndex();
			
			int valoracion1=jComboBox4.getSelectedIndex();
			int valoracion2=jComboBox5.getSelectedIndex();
			int valoracion3=jComboBox6.getSelectedIndex();
			int valoracion4=jComboBox7.getSelectedIndex();
			this.miFloristeria= new floristeria1(nombre1, valoracion1, nombre2, valoracion2, nombre3, valoracion3, nombre4, valoracion4);
double valortotal=miFloristeria.calcularValorTotal4Pedidos(cantidad0, cantidad1, cantidad2, cantidad3);
		JOptionPane.showMessageDialog(null, "El valor es:" + valortotal);
		
		}
		// TODO Auto-generated method stub

	}

}
